package gaobo.linkedlist;

import java.util.ArrayList;
import java.util.LinkedList;

public class LinkedListTest {

    public static void main(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        System.out.println(arrayList);

        LinkedList<Integer> list = new LinkedList<>();
        list.add(10);//默认尾插法
        list.add(20);
        list.add(30);
        list.add(2,19);
        System.out.println(list);

        for (int x:list) {
            System.out.print(x+" ");
        }
        System.out.println();

    }

}
